#pragma once

// CChosenFileCtrl
namespace tools
{
	enum ListView;
}

struct FileInfo;


class CChosenFileCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(CChosenFileCtrl)

public:
	CChosenFileCtrl(CImageList* ilSmall,CImageList* ilLarge);
	virtual ~CChosenFileCtrl();
	
	bool AddItem (FileInfo* info);
	void GetChoosenFile(CStringArray& ary);
	void BuildViewMap(CMap<tools::ListView,tools::ListView,
		UINT,UINT> *viewToID);
	void RemoveAllItems();
protected:
	CImageList* ilSmall;
	CImageList* ilLarge;
	bool columnOrder;
	int nowColumn;
	tools::ListView listview;

	CMap<tools::ListView,tools::ListView,UINT,UINT> *viewToID;

	void SetView(tools::ListView listview, UINT mask);
	void RemoveSelect();
	void FreeItemMemory();
	BOOL isItemExist(FileInfo* info);
	static int CALLBACK CompareColumnItem (LPARAM lParam1,
		LPARAM lParam2, LPARAM lParamSort);
	static int CALLBACK CompareColumnItemRev (LPARAM lParam1,
		LPARAM lParam2, LPARAM lParamSort);

	virtual void PreSubclassWindow();
	afx_msg void OnDestroy();
	afx_msg void OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMDblclk(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnLabelfileChosenfileRemove();
	afx_msg void OnLabelfileChosenfileReportView();
	afx_msg void OnLabelfileChosenfileSmallView();
	afx_msg void OnLabelfileChosenfileLargeView();
	afx_msg void OnLabelfileChosenfileListView();
	DECLARE_MESSAGE_MAP()
};


